﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DTOSingTowerMall;
using FacadeSingTowerMall;
using System.IO;

namespace MVCSingTowerMall.Controllers
{

    [HandleError]
    public class HomeController : Controller
    {
        MallInfoFacade mFacade;

        public HomeController()
        {
            mFacade = new MallInfoFacade();
        }

        public ActionResult Index()
        {
            ViewData["Message"] = "Welcome to ASP.NET MVC!";
            /* Added for easy debug need to be removed on deployment */
            string root = Server.MapPath("~");
            string parent = Path.GetDirectoryName(Path.GetDirectoryName(root));

            /***************************************************/
            IMallInfo mallInfo = mFacade.getMallInfo(parent + "\\Database\\MallInfo.xml");
            return View(mallInfo);
        }

        public ActionResult About()
        {
            return View();
        }

        public ActionResult Promotions()
        {
            return View();
        }
    }
}
